#include <iostream>
#include <vector>
#include "Line.h"

using namespace std;
//represents a node of a quadtree, containing a vector of lines within the bounds of the node's dimensions and 4 children
//class QuadNode;

class QuadNode{
    
public:
//constructor requires the top left vertex of the node,x_0 and y_0, and the the bottom right vertex as well as the vector of lines in this node.
//the constructor will take care of classifying the lines into the appropriate children

    QuadNode();
    ~QuadNode();
    QuadNode(double x_0,double y_0, double x_f, double y_f, vector<Line*> lines);
    
    QuadNode* getTopLeft();
    QuadNode* getTopRight();
    QuadNode* getBottomLeft();
    QuadNode* getBottomRight();
    vector<Line*> getLines();
    int getCount();
    
private:
    // children nodes
    QuadNode* top_left;
    QuadNode* top_right;
    QuadNode* bottom_left;
    QuadNode* bottom_right;
    QuadNode* allocateNode(double x_0, double y_0,double x_f,double y_f, vector<Line*> line_vec);

    double x_0;
    double x_f;
    double y_0;
    double y_f;
    
    //vector of lines that would be in more than one child
    vector<Line*> myLines;
       
    //takes lines in myLines and creates the child with the approriate set of liens
    void lineClassify(vector<Line*> lines);

};
